<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNodesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('nodes', function (Blueprint $table) {
            $table->id()->comment('节点id');
            $table->string('name')->comment('节点名称');
            //管理节点权限
            $table->string('route_name')->comment('路由别名');
            $table->unsignedInteger('pid')->comment('父级id');
            //因为要控制到按钮的权限所以要区别路由是否菜单
            $table->enum('is_menu',[0,1])->default(0)->comment('是否菜单 0:否 1:是');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('nodes');
    }
}
